import request from "@/utils/request"; //导入封装请求的js文件
//获取商品详情
export function getData(params) {
    return request({
      url: `/pmsProduct/${params}`,
      method: "get",
    });
  }
//获取店铺信息
export function pmsStore(params) {
  return request({
    url: `/pmsStore/${params}`,
    method: "get",
  });
}
export function pmsStoreB(params) {
  return request({
    url: `/pmsStore/selectById/${params}`,
    method: "get",
  });
}
//加入购物车
export function getCar(params) {
  return request({
    url: `/omsCartItem/add`,
    method: "post",
    data:params
  });
}
//购物车列表
export function selectMemberCartItemList(params) {
  return request({
    url: `/omsCartItem/selectMemberCartItemList`,
    method: "get",
    params:params
  });
}
//删除商品
export function deleteProductInCartItem(params) {
  return request({
    url: `/omsCartItem/deleteProductInCartItem`,
    method: "DELETE",
    params:params
  });
}  
//修改购物车商品数量
export function updateCartItemQuantity(params) {
  return request({
    url: `/omsCartItem/updateCartItemQuantity`,
    method: "PUT",
    params:params
  });
}  
//修改购物车中选中状态
export function updateCartItemChecked(params) {
  return request({
    url: `/omsCartItem/updateCartItemChecked`,
    method: "PUT",
    params:params
  });
}  
//根据购物车生成订单
export function generateOrder(params) {
  return request({
    url: `/omsOrder/generateOrder`,
    method: "POST",
    params:params
  });
}  
//解析地址
export function expressAddressResolution(params) {
  return request({
    url: `/omsOrder/expressAddressResolution`,
    method: "get",
    params:params
  });
}  
//获取省市区地址
export function selectAllAddress(params) {
  return request({
    url: `/omsOrder/selectAllAddress`,
    method: "get",
    params:params
  });
}  
//收藏商品
export function saveProductCollection(params) {
  return request({
    url: `/pmsProductCollection/saveProductCollection`,
    method: "POST",
    params:params
  });
}  
//商品取消收藏
export function deleteProductCollection(params) {
  return request({
    url: `/pmsProductCollection/deleteProductCollection`,
    method: "DELETE",
    params:params
  });
}  
//保存地址
export function collectionAddress(params) {
  return request({
    url: `/omsMemberAddress/collectionAddress`,
    method: "POST",
    data:params
  });
}  
//获取我的地址
export function selectMemberAddress(params) {
  return request({
    url: `/omsMemberAddress/selectMemberAddress`,
    method: "get",
    data:params
  });
}  
//获取订单商品信息
export function selectOrderItem(params) {
  return request({
    url: `/omsOrderItem/selectOrderItem`,
    method: "get",
    params:params
  });
}  
//修改订单中的商品规格
export function updateSkuDataOrQuantity(params,id) {
  return request({
    url: `/omsOrderItem/updateSkuDataOrQuantity?orderId=${id}`,
    method: "PUT",
    data:params
  });
}  
//提交订单
export function confirmAddress(params,id) {
  return request({
    url: `/omsOrder/confirmOrder?orderId=${id}`,
    method: "POST",
    data:params
  });
}
//支付页面详情
export function selectPayPageInfo(params) {
  return request({
    url: `/omsOrder/selectPayPageInfo`,
    method: "get",
    params:params
  });
}
//保存下载
export function saveDownloadHistory(params) {
  return request({
    url: `/pmsDownloadHistory/saveDownloadHistory`,
    method: "post",
    params:params
  });
}
//删除收货地址
export function omsMemberAddress(params) {
  return request({
    url: `/omsMemberAddress`,
    method: "DELETE",
    params:params
  });
}
//获取微信支付
export function createJsapi(params) {
  return request({
    url: `/payment/weixin/createOrder/${params}`,
    method: "GET",
  });
}
//获取订单支付状态
export function queryPayStatus(params) {
  return request({
    url: `/payment/weixin/queryPayStatus/${params}`,
    method: "GET",
    headers:{
      showLoading:false
    }
  });
}
//立即下单
export function immediateOrder(params) {
  return request({
    url: `/omsOrder/immediateOrder`,
    method: "post",
    data:params
  });
}
//获取店铺详情分类
export function selectCategoryByStoreId(params) {
  return request({
    url: `/pmsStore/selectCategoryByStoreId`,
    method: "get",
    params:params
  });
}
//获取店铺详情商品列表
export function selectAllByParamsOnStoreByStoreId(params) {
  return request({
    url: `/pmsStore/selectAllByParamsOnStoreByStoreId`,
    method: "get",
    params:params
  });
}
//获取最近上心
export function selectLastNewProductForStore(params) {
  return request({
    url: `/pmsStore/selectLastNewProductForStore`,
    method: "get",
    params:params
  });
}
//获取分类
export function getAllListByChildren(params) {
  return request({
    url: `/pmsProductCategory/getAllListByChildren`,
    method: "get",
    params:params
  });
}